package cn.bughub.controller;

import cn.bughub.service.CaptchaService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * 验证码控制器
 *
 * @author zwj
 * @date 2024-09-24
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/captcha")
public class CaptchaController {
    
    private final CaptchaService captchaService;
    
    /**
     * 生成验证码
     */
    @GetMapping("/generateCaptcha")
    public void generateCaptcha() {
        
        try {
            captchaService.generateCaptcha();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    
}
